<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>乐淘</title>
  <link rel="stylesheet" href="./lib/bootstrap/css/bootstrap.css">
  <link rel="stylesheet" href="./lib/bootstrap-validator/css/bootstrapValidator.css">
  <link rel="stylesheet" href="./lib/nprogress/nprogress.css">
  <link rel="stylesheet" href="./css/common.css">
</head>

<body>
  <!-- 首页页面布局 -->
  <!-- 分为侧边导航栏，和主体部分 -->
  <div class="aside-nav bg-color transition">
    <div class="title">
      <h3>乐淘-54</h3>
    </div>
    <div class="icon">
      <img src="./images/default.png" alt="">
      <h4>超级管理员</h4>
    </div>
    <div class="nav">
      <a href="./user.html"><i class="glyphicon glyphicon-user"></i>用户管理 </a>
      <div>
        <a href="javascript:" class="cate"><i class="glyphicon glyphicon-list"></i>分类管理</a>
        <div class="pd-l" id="cate">
          <a href="./cate1.html">一级分类</a>
          <a href="./cate2.html" class="current">二级分类</a>
        </div>
      </div>
      <a href="./products.html"> <i class="glyphicon glyphicon-th"></i>商品管理</a>
    </div>
  </div>
  <div class="main transition pad-left">
    <div class="header">
      <a href="#" class="transition menu"><i class=" glyphicon glyphicon-align-justify pull-left"></i></a>
      <button type="button" id="btn-out" class="btn pull-right" data-toggle="modal" data-target=".bs-example-modal-sm">
        <i class=" glyphicon glyphicon-log-out"></i>
      </button>

    </div>
    <div class="body">
      <!-- 路径导航 -->
      <ol class="breadcrumb">
        <li><a href="./index.html">管理系统</a></li>
        <li class="active">分类管理</li>
        <li class="active">二级分类</li>
      </ol>
      <!-- 添加分类按钮 -->
      <button class="btn btn-default mb-20 btn-add"data-toggle="modal" data-target=".add-second">添加分类</button>
      <!-- 数据表格 -->
      <table class="table table-bordered table-hover text-center">
        <thead>
          <tr>
            <th>序号</th>
            <th>一级分类名称</th>
            <th>二级分类名称</th>
            <th>二级分类LOGO</th>
          </tr>
        </thead>
        <tbody></tbody>
      </table>
      <!-- 分页容器 -->
      <div class="pull-right">
        <ul id="paginator"></ul>
      </div>
    </div>
  </div>
  <!-- 退出功能模态框 -->
  <div id="modal-out" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel"
    aria-hidden="true">
    <div class="modal-dialog modal-sm">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <p class="modal-title tit" id="myModalLabel">温馨提示</p>
        </div>
        <div class="modal-body info">
          您确定要退出后台管理系统吗？
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="button" class="btn btn-primary btn-out">退出</button>
        </div>
      </div>
    </div>
  </div>

  <!-- 添加分类功能 模态框 -->
  <div id="modal-second-add" class="modal fade add-second" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel"
    aria-hidden="true">
    <div class="modal-dialog modal-sm modal-second">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <p class="modal-title tit" id="myModalLabel">添加分类</p>
        </div>
        <div class="modal-body info">
          <form class="" id="add-form">
            <!-- 表单组 -->
            <!-- 下拉菜单 -->
            <!-- 这里不用select下拉列表来做  样式不好更改-->
            <!-- 使用boostrap插件的下拉菜单来做  -->
            <div class="form-group">
              <div class="dropdown md-20">
                <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown"
                  aria-expanded="true">
                  <span id="dropdownText">请选择一级分类</span>
                  <span class="caret"></span>
                </button>
                <ul class="dropdown-menu dropdown-text" role="menu" aria-labelledby="dropdownMenu1">
                </ul>
              </div>
              <!-- 因为下拉列表不是使用表单做的，所以提交表单，不能获取它的数据 => 使用隐藏域，接收一级分类的id -->
              <input type="hidden" name="categoryId" id="categoryId">
            </div>
            <div class="form-group">
              <input type="text" name="brandName" class="form-control" placeholder="请输入二级分类">
            </div>
            <div class="form-group">
              <!-- 这里同理 使用label实现好看的样式  for关联表单 -->
              <label for="fileupload" class="btn btn-default">上传文件</label>
              <!-- hide：html5提供的隐藏表单的类名 -->
              <input type="file" name="pic1" id="fileupload" class="hide" data-url="/category/addSecondCategoryPic">
            </div>
            <div class="form-group img-box">
              <img src="./images/none.png" alt="">
              <!-- 因为img 不是表单 => 使用隐藏域，接收文件服务器返回的图片的地址 -->
              <input type="hidden" name="brandLogo" id="brandLogo">
            </div>
          </form>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <!-- h5新增的form属性，可以指定 表单 所属的表单域 将表单域外面的表单和表单域关联起来 -->
          <!-- 提交表单的数据，必须是submit -->
          <button type="submit" class="btn btn-primary btn-add" form="add-form">添加</button>
        </div>
      </div>
    </div>
  </div>

  <!-- 准备模板 -->
  <script type="text/html" id="tmp">
      {{each rows v i}}
          <tr>
            <td>{{i + 1 + size * (page-1)}}</td>
              <td>{{v.categoryName}}</td>
              <td>{{v.brandName}}</td>
              <td><img src="{{v.brandLogo}}" alt="" height="70px"></td>
          </tr>
      {{/each}}
  </script>


  <!-- 一级分类的下拉列表 模板 -->
  <script type="text/html" id="tp">
    {{each rows v i}}
    <li role="presentation"><a href="#" class="li-a" data-id={{v.id}}>{{v.categoryName}}</a></li>
    {{/each}}
  </script>
  <script src="./lib/jquery/jquery.js"></script>
  <script src="./lib/bootstrap/js/bootstrap.js"></script>
  <script src="./lib/bootstrap-validator/js/bootstrapValidator.js"></script>
  <script src="./lib/bootstrap-paginator/bootstrap-paginator.min.js"></script>
  <script src="./lib/nprogress/nprogress.js"></script>
  <script src="./lib/artTemplate/template-web.js"></script>
  <script src="./lib/jquery-fileupload/jquery.ui.widget.js"></script>
  <script src="./lib/jquery-fileupload/jquery.fileupload.js"></script>
  <script src="./js/common.js"></script>
  <script src="./js/category2.js"></script>
</body>

</html>